package com.tx.springcloud.consumerfeign.controller;

import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import com.tx.springcloud.consumerfeign.teleservice.HelloRemote;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author ：tx
 * @description：
 * @date ：Created in 2019/4/17 15:32
 * @modified By：
 * @version:
 */
@RestController
public class CallHelloController {

    @Autowired
    HelloRemote helloRemote;

    @RequestMapping("/hello/{name}")
    @HystrixCommand(fallbackMethod = "fall")
    public String callHello(@PathVariable(value = "name")String userName){
        return helloRemote.hello(userName);
    }

    public String fall(String name){
        return "222";
    }
}
